<template>
    <div>
        <!-- 面包屑导航 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>会员配置列表</el-breadcrumb-item>
        </el-breadcrumb>

        <!-- 添加 -->
        <el-form :inline="true" style="margin-top: 20px;">
            <el-form-item>
                <el-button size="small" type="primary" icon="el-icon-plus" @click="upMember()">添加</el-button>
            </el-form-item>
        </el-form>

        <!-- 列表 -->
        <el-table size="small" :data="MemberData" element-loading-text="拼命加载中" style="width: 100%;">
            <el-table-column align="center" sortable type="index" label="序号"></el-table-column>
            <el-table-column align="center" sortable prop="name" label="名称" width="120"></el-table-column>
            <el-table-column align="center" sortable prop="price" label="价格" width="120"></el-table-column>
            <el-table-column align="center" sortable prop="year1" label="自营桩服务费年份(前)" width="160"></el-table-column>
            <el-table-column align="center" sortable prop="servicePercent1" label="自营桩服务费百分比(前)" width="180">
                <template slot-scope="scope">
                    <div>{{
                scope.row.servicePercent1 }}%</div>
                </template>
            </el-table-column>
            <el-table-column align="center" sortable prop="year1" label="自营桩服务费年份(后)" width="160"></el-table-column>
            <el-table-column align="center" sortable prop="servicePercent2" label="自营桩服务费百分比(后)" width="180">
                <template slot-scope="scope">
                    <div>{{
                scope.row.servicePercent2 }}%</div>
                </template>
            </el-table-column>

            <el-table-column align="center" sortable prop="year2" label="分享服务费年份(前)" width="150"></el-table-column>
            <el-table-column align="center" sortable prop="shareService1" label="分享服务费百分比(前)" width="160">
                <template slot-scope="scope">
                    <div>{{
                scope.row.shareService1 }}%</div>
                </template>
            </el-table-column>
            <el-table-column align="center" sortable prop="year2" label="分享服务费年份(后)" width="150"></el-table-column>
            <el-table-column align="center" sortable prop="shareService2" label="分享服务费百分比(后)" width="160">
                <template slot-scope="scope">
                    <div>{{
                scope.row.shareService2 }}%</div>
                </template>
            </el-table-column>

            <el-table-column align="center" sortable prop="year3" label="区域服务费年份(前)" width="190"></el-table-column>
            <el-table-column align="center" sortable prop="areaService1" label="区域服务费百分比(前)" width="200">
                <template slot-scope="scope">
                    <div>{{
                scope.row.areaService1 }}%</div>
                </template>
            </el-table-column>
            <el-table-column align="center" sortable prop="year3" label="区域服务费年份(后)" width="190"></el-table-column>
            <el-table-column align="center" sortable prop="areaService2" label="区域服务费百分比(后)" width="200">
                <template slot-scope="scope">
                    <div>{{
                scope.row.areaService2 }}%</div>
                </template>
            </el-table-column>

            <el-table-column align="center" sortable prop="createTime" label="创建时间" width="150">
                <template slot-scope="scope">
                    <div>{{ transformDate(scope.row.createTime) }}</div>
                </template>
            </el-table-column>
            <el-table-column align="center" label="操作" width="400" fixed="right">
                <template slot-scope="scope">
                    <el-button size="mini" type="primary" @click="upJujianF(scope.row)">设置居间费</el-button>
                    <el-button size="mini" type="primary" @click="openMember(scope.row)">查看详情</el-button>
                    <el-button size="mini" type="primary" @click="upMember(scope.row)">修改</el-button>
                    <el-button size="mini" type="danger" @click="deleMember(scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>

        <!-- 查看详情 -->
        <el-dialog title="会员配置详情页：" :visible.sync="editFormDetails">
            <el-form label-width="210px">
                <el-form-item label="名称：">
                    <span v-html="this.Details.name"></span>
                </el-form-item>
                <el-form-item label="价格：">
                    <span v-html="this.Details.price"></span>
                </el-form-item>
                <el-form-item label="自营桩服务费年份(前)：">
                    <span
                        v-if="this.Details.year1 !== '' && this.Details.year1 !== null && this.Details.year1 != undefined"
                        v-html="'前' + this.Details.year1 + '年'"></span>
                    <span></span>
                </el-form-item>
                <el-form-item label="自营桩服务费百分比(前)： ">
                    <span
                        v-if="this.Details.servicePercent1 !== '' && this.Details.servicePercent1 !== null && this.Details.servicePercent1 != undefined"
                        v-html="this.Details.servicePercent1 + '%'"></span>
                </el-form-item>
                <el-form-item label="自营桩服务费年份(后)：">
                    <span
                        v-if="this.Details.year1 !== '' && this.Details.year1 !== null && this.Details.year1 != undefined"
                        v-html="this.Details.year1 + '年后'"></span>
                </el-form-item>
                <el-form-item label="自营桩服务费百分比(后)： ">
                    <span
                        v-if="this.Details.servicePercent2 !== '' && this.Details.servicePercent2 !== null && this.Details.servicePercent2 != undefined"
                        v-html="this.Details.servicePercent2 + '%'"></span>
                </el-form-item>

                <el-form-item label="分享服务费年份(前)：">
                    <span
                        v-if="this.Details.year2 !== '' && this.Details.year2 !== null && this.Details.year2 != undefined"
                        v-html="'前' + this.Details.year2 + '年'"></span>
                    <span></span>
                </el-form-item>
                <el-form-item label="分享服务费百分比(前)： ">
                    <span
                        v-if="this.Details.shareService1 !== '' && this.Details.shareService1 !== null && this.Details.shareService1 != undefined"
                        v-html="this.Details.shareService1 + '%'"></span>
                </el-form-item>
                <el-form-item label="分享服务费年份(后)：">
                    <span
                        v-if="this.Details.year2 !== '' && this.Details.year2 !== null && this.Details.year2 != undefined"
                        v-html="this.Details.year2 + '年后'"></span>
                </el-form-item>
                <el-form-item label="分享服务费百分比(后)： ">
                    <span
                        v-if="this.Details.shareService2 !== '' && this.Details.shareService2 !== null && this.Details.shareService2 != undefined"
                        v-html="this.Details.shareService2 + '%'"></span>
                </el-form-item>

                <el-form-item label="区域服务费年份(前)：">
                    <span
                        v-if="this.Details.year3 !== '' && this.Details.year3 !== null && this.Details.year3 != undefined"
                        v-html="'前' + this.Details.year3 + '年'"></span>
                    <span></span>
                </el-form-item>
                <el-form-item label="区域服务费百分比(前)： ">
                    <span
                        v-if="this.Details.areaService1 !== '' && this.Details.areaService1 !== null && this.Details.areaService1 != undefined"
                        v-html="this.Details.areaService1 + '%'"></span>
                </el-form-item>
                <el-form-item label="区域服务费年份(后)：">
                    <span
                        v-if="this.Details.year3 !== '' && this.Details.year3 !== null && this.Details.year3 != undefined"
                        v-html="this.Details.year3 + '年后'"></span>
                </el-form-item>
                <el-form-item label="区域服务费百分比(后)： ">
                    <span
                        v-if="this.Details.areaService2 !== '' && this.Details.areaService2 !== null && this.Details.areaService2 != undefined"
                        v-html="this.Details.areaService2 + '%'"></span>
                </el-form-item>
                <el-form-item label="会员协议：" class="agreement">
                    <span v-html="this.Details.agreement"></span>
                </el-form-item>
                <el-form-item label="描述：" class="agreement">
                    <span v-html="this.Details.description"></span>
                </el-form-item>
                <el-form-item label="创建时间：" prop="createTime">
                    {{ transformDate(this.Details.createTime) }}
                </el-form-item>
            </el-form>
        </el-dialog>

        <!-- 编辑界面 -->
        <el-dialog :title="tit" :visible.sync="editFormVisiible" width="60%">
            <el-form label-width="190px">
                <el-form-item label="名称">
                    <el-input size="small" v-model="xiugai.name" auto-complete="off" placeholder="请输入名称"></el-input>
                </el-form-item>
                <el-form-item label="价格">
                    <el-input size="small" v-model="xiugai.price" auto-complete="off" placeholder="请输入价格"></el-input>
                </el-form-item>
                <el-form-item label="自营桩服务费年份(前)">
                    <div style="display: flex;">
                        前<el-input size="small" v-model="xiugai.year1" auto-complete="off"
                            style="width: 80px;margin: 0 4px;"></el-input>年
                    </div>
                </el-form-item>
                <el-form-item label="自营桩服务费百分比(前)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.servicePercent1" auto-complete="off"
                            placeholder="自营桩服务费百分比(前)"></el-input>%
                    </div>
                </el-form-item>
                <el-form-item label="自营桩服务费年份(后)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.year1" auto-complete="off"
                            style="width: 80px;margin: 0 4px;" :readonly="true"></el-input>年后
                    </div>
                </el-form-item>
                <el-form-item label="自营桩服务费百分比(后)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.servicePercent2" auto-complete="off"
                            placeholder="自营桩服务费百分比(后)"></el-input>%
                    </div>
                </el-form-item>

                <el-form-item label="分享服务费年份(前)">
                    <div style="display: flex;">
                        前<el-input size="small" v-model="xiugai.year2" auto-complete="off"
                            style="width: 80px;margin: 0 4px;"></el-input>年
                    </div>
                </el-form-item>
                <el-form-item label="分享服务费百分比(前)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.shareService1" auto-complete="off"
                            placeholder="分享服务费百分比(前)"></el-input>%
                    </div>
                </el-form-item>
                <el-form-item label="分享服务费年份(后)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.year2" auto-complete="off"
                            style="width: 80px;margin: 0 4px;" :readonly="true"></el-input>年后
                    </div>
                </el-form-item>
                <el-form-item label="分享服务费百分比(后)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.shareService2" auto-complete="off"
                            placeholder="分享服务费百分比(后)"></el-input>%
                    </div>
                </el-form-item>

                <el-form-item label="区域服务费年份(前)">
                    <div style="display: flex;">
                        前<el-input size="small" v-model="xiugai.year3" auto-complete="off"
                            style="width: 80px;margin: 0 4px;"></el-input>年
                    </div>
                </el-form-item>
                <el-form-item label="区域服务费百分比(前)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.areaService1" auto-complete="off"
                            placeholder="区域服务费百分比(前)"></el-input>%
                    </div>
                </el-form-item>
                <el-form-item label="区域服务费年份(后)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.year3" auto-complete="off"
                            style="width: 80px;margin: 0 4px;" :readonly="true"></el-input>年后
                    </div>
                </el-form-item>
                <el-form-item label="区域服务费百分比(后)">
                    <div style="display: flex; width: 30%;">
                        <el-input size="small" v-model="xiugai.areaService2" auto-complete="off"
                            placeholder="区域服务费百分比(后)"></el-input>%
                    </div>
                </el-form-item>
                <el-form-item label="会员协议" style="height: 400px;">
                    <quill-editor v-model="xiugai.agreement" :options="editorOption1" style="height: 300px;"
                        ref="QuillEditor1">
                    </quill-editor>
                </el-form-item>
                <el-form-item label="描述" style="height: 400px;">
                    <quill-editor v-model="xiugai.description" :options="editorOption" style="height: 300px;"
                        ref="QuillEditor">
                    </quill-editor>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button size="small" @click='closeDialog()'>取消</el-button>
                <el-button size="small" type="primary" :loading="loading" @click="addMembers()"
                    v-if="tit == '添加'">添加</el-button>
                <el-button size="small" type="primary" :loading="loading" @click="upMembers()"
                    v-if="tit == '修改'">修改</el-button>
            </div>
        </el-dialog>
        <!-- 富文本图片 -->
        <el-dialog title="选择图片" :visible.sync="uploadVisible" width="190px">
            <div>
                <div class="upload-demo">
                    <el-upload action="" :http-request="mainImgUpload" :show-file-list="false" list-type="picture-card">
                        <i class="el-icon-plus"></i>
                    </el-upload>
                </div>
            </div>
        </el-dialog>
        <!-- 富文本图片 -->
        <el-dialog title="选择图片" :visible.sync="uploadVisible1" width="190px">
            <div>
                <div class="upload-demo">
                    <el-upload action="" :http-request="mainImgUpload1" :show-file-list="false"
                        list-type="picture-card">
                        <i class="el-icon-plus"></i>
                    </el-upload>
                </div>
            </div>
        </el-dialog>

        <el-dialog :title="tit" :visible.sync="editFormVisiibleJjF" width="60%">
            <el-form label-width="270px">
                <el-form-item label="推荐用户开通游侠获得居间费">
                    <el-input size="small" v-model="fees.yxFees" auto-complete="off"
                        placeholder="请输入推荐用户开通游侠获得居间费"></el-input>
                </el-form-item>
                <el-form-item label="推荐用户开通共享桩主获得居间费">
                    <el-input size="small" v-model="fees.gxzzFees" auto-complete="off"
                        placeholder="请输入推荐用户开通共享桩主获得居间费"></el-input>
                </el-form-item>
                <el-form-item label="推荐用户开通至尊桩主获得居间费">
                    <el-input size="small" v-model="fees.zzzzFees" auto-complete="off"
                        placeholder="请输入推荐用户开通至尊桩主获得居间费"></el-input>
                </el-form-item>
                <el-form-item label="推荐用户开通剑客获得居间费百分比">
                    <div style="width: 50%;display: flex;">
                        <el-input size="small" v-model="fees.jkFees" auto-complete="off"
                            placeholder="请输入推荐用户开通剑客获得居间费百分比"></el-input>%
                    </div>

                </el-form-item>
                <el-form-item label="推荐用户开通区域中心获得居间费百分比">
                    <div style="width: 50%;display: flex;">
                        <el-input size="small" v-model="fees.qyzxFees" auto-complete="off"
                            placeholder="请输入推荐用户开通区域中心获得居间费百分比"></el-input>%
                    </div>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button size="small" @click='closeDialogJjF()'>取消</el-button>
                <el-button size="small" type="primary" :loading="loading" @click="upMembersJjF()">修改</el-button>
            </div>
        </el-dialog>

        <!-- 分页组件 -->
        <Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
    </div>
</template>

<script>
import {
    getMemberList,
    getMemberInfo,
    addMember,
    deleteMember,
    upMember
} from "../../api/userMG";
import client from "@/utils/ossClient.js";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import Pagination from '../../components/Pagination'
// 工具栏配置
const toolbarOptions = [
    ["bold", "italic", "underline", "strike"], // toggled buttons
    ["blockquote", "code-block"],

    [{ header: 1 }, { header: 2 }], // custom button values
    [{ list: "ordered" }, { list: "bullet" }],
    [{ script: "sub" }, { script: "super" }], // superscript/subscript
    [{ indent: "-1" }, { indent: "+1" }], // outdent/indent
    [{ direction: "rtl" }], // text direction

    [{ size: ["small", false, "large", "huge"] }], // custom dropdown
    [{ header: [1, 2, 3, 4, 5, 6, false] }],

    [{ color: [] }, { background: [] }], // dropdown with defaults from theme
    [{ font: [] }],
    [{ align: [] }],
    ["link", "image", "video"], // 对于图片上传这是重点
    ["clean"], // remove formatting button
];
export default {
    data() {
        return {
            MemberData: [],
            loading: false,
            editFormDetails: false,
            Details: [],
            editFormVisiible: false,
            xiugai: {
                id: '',
                name: '',
                price: '',
                commission: '',
                percent: '',
                year1: '',
                year2: '',
                servicePercent1: '',
                servicePercent2: '',
                shareService1: '',
                shareService2: '',
                year3: '',
                areaService1: '',
                areaService2: '',
                agreement: '',
                description: '',
                createTime: ''
            },
            tit: '添加',
            uploadVisible: false,
            uploadVisible1: false,
            editorOption: {
                modules: {
                    toolbar: {
                        container: toolbarOptions, // 工具栏
                        handlers: {
                            image: (value) => {
                                if (value) {
                                    // 在这里编写图片按钮点击操作
                                    this.uploadVisible = true;
                                    this.cursorIndex =
                                        this.$refs.QuillEditor.quill.getSelection().index;
                                } else {
                                    this.quill.format("image", false);
                                }
                            },
                        },
                    },
                },
            },
            editorOption1: {
                modules: {
                    toolbar: {
                        container: toolbarOptions, // 工具栏
                        handlers: {
                            image: (value) => {
                                if (value) {
                                    // 在这里编写图片按钮点击操作
                                    this.uploadVisible1 = true;
                                    this.cursorIndex =
                                        this.$refs.QuillEditor1.quill.getSelection().index;
                                } else {
                                    this.quill.format("image", false);
                                }
                            },
                        },
                    },
                },
            },
            // 分页参数
            pageparm: {
                currentPage: 1,
                pageSize: 20,
                total: 10
            },
            editFormVisiibleJjF: false,
            fees: {
                id: '',
                yxFees: '',
                gxzzFees: '',
                zzzzFees: '',
                jkFees: '',
                qyzxFees: ''
            }
        }
    },
    created() {
        this.getdata(1);
    },
    // 注册组件
    components: {
        Pagination
    },
    methods: {
        upMembersJjF() {
            this.loading = true
            upMember(this.fees).then((res) => {
                this.loading = false;
                if (res.code == 200) {
                    this.editFormVisiibleJjF = false
                    this.$message.success(res.msg)
                    this.getdata(this.pageparm.currentPage)
                } else {
                    this.editFormVisiibleJjF = false
                    this.$message.error(res.msg);
                }
            })
        },
        closeDialogJjF() {
            this.editFormVisiibleJjF = false
        },
        // 打开居间费编辑器
        upJujianF(row) {
            var userdata = JSON.parse(localStorage.getItem("userdata"))
            this.$prompt('请输入密码', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                inputPattern: /^(?!(\s+$))/,
                inputErrorMessage: '不可以空数据提交!'
            }).then(({ value }) => {
                if (value === userdata.menuTwo) {
                    this.editFormVisiibleJjF = true
                    this.fees.id = row.id
                    this.fees.yxFees = row.yxFees
                    this.fees.gxzzFees = row.gxzzFees
                    this.fees.zzzzFees = row.zzzzFees
                    this.fees.jkFees = row.jkFees
                    this.fees.qyzxFees = row.qyzxFees
                } else {
                    this.$message({
                        type: 'error',
                        message: '密码错误'
                    });
                }
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '取消输入'
                });
            });

        },
        // 分页插件事件
        callFather(parm) {
            this.pageparm.page = parm.currentPage
            this.getdata(parm.currentPage)
        },
        mainImgUpload1(file) {
            var self = this;
            //判断扩展名
            const tmpcnt = file.file.name.lastIndexOf(".");
            const exname = file.file.name.substring(tmpcnt + 1);
            const names = ["jpg", "jpeg", "webp", "png", "bmp"];
            // if (names.indexOf(exname) < 0) {
            //   this.$message.error("不支持的格式!");
            //   return;
            // }
            const fileName = file.file.uid + "." + exname;
            client
                .put(fileName, file.file)
                .then((res) => {
                    if (res.url) {
                        console.log('res.url=======', res.url)
                        self.getUrl1(res.url);
                    } else {
                        this.$message.error("文件上传失败");
                    }
                })
                .catch((err) => { });
        },

        getUrl1(url) {
            this.uploadVisible1 = false;
            // 获取富文本组件实例
            let quill = this.$refs.QuillEditor1.quill;
            // 如果上传成功
            if (url) {
                // 插入图片，res为服务器返回的图片链接地址
                quill.insertEmbed(this.cursorIndex, "image", url);
                // 调整光标到最后
                quill.setSelection(this.cursorIndex + 1);
            } else {
                // 提示上传失败信息
            }
        },
        mainImgUpload(file) {
            var self = this;
            //判断扩展名
            const tmpcnt = file.file.name.lastIndexOf(".");
            const exname = file.file.name.substring(tmpcnt + 1);
            const names = ["jpg", "jpeg", "webp", "png", "bmp"];
            // if (names.indexOf(exname) < 0) {
            //   this.$message.error("不支持的格式!");
            //   return;
            // }
            const fileName = file.file.uid + "." + exname;
            client
                .put(fileName, file.file)
                .then((res) => {
                    if (res.url) {
                        console.log('res.url=======', res.url)
                        self.getUrl(res.url);
                    } else {
                        this.$message.error("文件上传失败");
                    }
                })
                .catch((err) => { });
        },

        getUrl(url) {
            this.uploadVisible = false;
            // 获取富文本组件实例
            let quill = this.$refs.QuillEditor.quill;
            // 如果上传成功
            if (url) {
                // 插入图片，res为服务器返回的图片链接地址
                quill.insertEmbed(this.cursorIndex, "image", url);
                // 调整光标到最后
                quill.setSelection(this.cursorIndex + 1);
            } else {
                // 提示上传失败信息
            }
        },
        // 打开详情页面
        openMember(row) {
            this.loading = true;
            this.editFormDetails = true;
            let data = {
                id: row.id
            }
            getMemberInfo(data).then((res) => {
                this.loading = false;
                if (res.code != 200) {
                    this.$Message({
                        type: "info",
                        message: res.msg
                    });
                } else {
                    this.Details = res.data.data;
                    return;
                }
            })
        },
        // 删除
        deleMember(row) {
            var userdata = JSON.parse(localStorage.getItem("userdata"))
            this.$prompt('请输入密码', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                inputPattern: /^(?!(\s+$))/,
                inputErrorMessage: '不可以空数据提交!'
            }).then(({ value }) => {
                if (value === userdata.menuTwo) {
                    this.$confirm('确定删除吗？', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'error'
                    }).then(() => {
                        let data = {
                            id: row.id
                        }
                        deleteMember(data).then(res => {
                            if (res.code == 200) {
                                this.$message.success(res.msg)
                                this.getdata(this.pageparm.currentPage)
                            } else {
                                this.$message.error(res.msg);
                            }
                        })
                    }).catch(() => {
                        this.$message({
                            type: 'info',
                            message: '已取消删除'
                        });
                    });
                } else {
                    this.$message({
                        type: 'error',
                        message: '密码错误'
                    });
                }
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '取消输入'
                });
            });
        },
        // 修改
        upMembers() {
            this.loading = true
            upMember(this.xiugai).then((res) => {
                this.loading = false;
                if (res.code == 200) {
                    this.editFormVisiible = false
                    this.$message.success(res.msg)
                    this.getdata(this.pageparm.currentPage)
                } else {
                    this.editFormVisiible = false
                    this.$message.error(res.msg);
                }
            })
        },
        // 添加
        addMembers() {
            this.loading = true
            addMember(this.xiugai).then((res) => {
                this.loading = false;
                if (res.code == 200) {
                    this.editFormVisiible = false
                    this.$message.success(res.msg)
                    this.getdata(1)
                } else {
                    this.editFormVisiible = false
                    this.$message.error(res.msg);
                }
            })
        },
        // 打开编辑器
        upMember(row) {
            var userdata = JSON.parse(localStorage.getItem("userdata"))
            this.$prompt('请输入密码', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                inputPattern: /^(?!(\s+$))/,
                inputErrorMessage: '不可以空数据提交!'
            }).then(({ value }) => {
                if (value === userdata.menuTwo) {
                    this.editFormVisiible = true;
                    if (row != undefined && row != "undefined") {
                        this.tit = "修改"
                        this.xiugai.id = row.id
                        this.xiugai.name = row.name
                        this.xiugai.price = row.price
                        this.xiugai.commission = row.commission
                        this.xiugai.percent = row.percent
                        this.xiugai.year1 = row.year1
                        this.xiugai.servicePercent1 = row.servicePercent1
                        this.xiugai.servicePercent2 = row.servicePercent2
                        this.xiugai.year2 = row.year2
                        this.xiugai.shareService1 = row.shareService1
                        this.xiugai.shareService2 = row.shareService2
                        this.xiugai.year3 = row.year3
                        this.xiugai.areaService1 = row.areaService1
                        this.xiugai.areaService2 = row.areaService2
                        this.xiugai.agreement = row.agreement
                        this.xiugai.description = row.description
                        this.xiugai.createTime = row.createTime
                    } else {
                        this.tit = "添加"
                        this.xiugai.id = ''
                        this.xiugai.name = ''
                        this.xiugai.price = ''
                        this.xiugai.commission = ''
                        this.xiugai.percent = ''
                        this.xiugai.year1 = ''
                        this.xiugai.year2 = ''
                        this.xiugai.servicePercent1 = ''
                        this.xiugai.servicePercent2 = ''
                        this.xiugai.shareService1 = ''
                        this.xiugai.shareService2 = ''
                        this.xiugai.year3 = ''
                        this.xiugai.areaService1 = ''
                        this.xiugai.areaService2 = ''
                        this.xiugai.agreement = ''
                        this.xiugai.description = ''
                        this.xiugai.createTime = ''
                    }
                } else {
                    this.$message({
                        type: 'error',
                        message: '密码错误'
                    });
                }
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '取消输入'
                });
            });
        },
        // 关闭编辑对话框
        closeDialog() {
            this.editFormVisiible = false
            this.$message({
                type: 'info',
                message: '已取消编辑'
            })
        },
        // 获取数据
        getdata(page) {
            this.loading = true;
            var parameter = {
                page: (page - 1) * 20,
            };
            getMemberList(parameter).then((res) => {
                this.loading = false;
                if (res.code != 200) {
                    this.$Message({
                        type: "info",
                        message: res.msg,
                    });
                } else {
                    this.MemberData = res.data.list;
                    this.pageparm.currentPage = page;
                    this.pageparm.total = res.data.count;
                    return;
                }
            })
        },
    }
}
</script>

<style>
.agreement img {
    max-width: 100%;
}
</style>